package com.bwie.controller;

import com.bwie.pojo.TbCourse;
import com.bwie.service.IUserService;
import com.bwie.service.TbCourseService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * description:
 *
 * @Author caoshuaifeng
 * @Create 2025/3/12 10:41
 * @Version 1.0
 */
@RestController
@RequestMapping("/course/index")
public class IndexController {
    @Autowired
    TbCourseService tbCourseService;

    @Autowired
    IUserService iUserService;


    @PostMapping("/getCourseList")
    public R getCourseList(@RequestBody PageInfoVo pageInfoVo){
        return tbCourseService.getCourseList(pageInfoVo);

    }

    @PostMapping("/getDifficulty")
    public R getDifficulty(){
        return tbCourseService.getDifficulty();
    }

    @PostMapping("/getCourseById")
    public R getCourseById(@RequestBody TbCourse tbCourse){
        return tbCourseService.getCourseById(tbCourse);

    }

    @PostMapping("/getUserById1/{userId}")
    public R getUserById1(@PathVariable("userId") Integer userId){
     return iUserService.getUserById(userId);
    }
}
